package view.views;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

import controller.Controller;

import view.ToolBar;
import view.components.IPTextArea;

public class NewSubnetContentPanelView extends DefaultContentPanelView {
	private static final long serialVersionUID = 1L;
	final static String Panel_Name = "Subnetze";
	private IPTextArea subnetzIpArea;
	private IPTextArea subnetzIPArea;
	private JButton saveButton;

	public NewSubnetContentPanelView() {
		this.setName(Panel_Name);

	}

	@Override
	public void load() {
		this.removeAll();
		this.setLayout(new GridLayout(3, 1));
		this.add(HostArea());
		JPanel p = new JPanel();
		saveButton = new JButton("Speichern");
		saveButton.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub

			}
		});

		p.add(saveButton, BorderLayout.AFTER_LAST_LINE);
		this.add(p);
		loadToolBar();

	}

	public void loadToolBar(){
		ToolBar toolBar = Controller.getInstance().getGuiBuilder().getToolBar();
		toolBar.addButton("save.png", null, "Speichern");
		toolBar.addButton("das", null, null);
		toolBar.addButton("das", null, null);
		
	}
	public JPanel HostArea() {

		JPanel hostPan = new JPanel();
		hostPan.setLayout(new GridLayout(6, 1, 0, 5));
		JComboBox ComboBox = new JComboBox();
		JLabel name = new JLabel("Netzwer Adresse");
		hostPan.add(name);
		ComboBox.setPreferredSize(new Dimension(100, 20));
		hostPan.add(ComboBox);
		name = new JLabel("Anzahl von Clienten");
		hostPan.add(name);
		TextField text = new TextField();
		text.setPreferredSize(new Dimension(60, 20));
		hostPan.add(text);
		name = new JLabel("Subnetz Adresse");
		hostPan.add(name);
		subnetzIpArea = new IPTextArea();
		hostPan.add(subnetzIpArea);
		name = new JLabel("Subnetz Maske");
		hostPan.add(name);
		subnetzIPArea = new IPTextArea();
		hostPan.add(subnetzIPArea);

		return hostPan;
	}

	public JPanel Subnet() {
		JPanel subnetPanel = new JPanel();

		return subnetPanel;
	}

	public JPanel details() {
		JPanel detailPanel = new JPanel();
		detailPanel.setLayout(new GridLayout(2, 1, 0, 0));
		detailPanel.add(new JLabel("dasda"));
		detailPanel.add(new JLabel("dasda"));
		return detailPanel;

	}
}
